﻿using EntityFramework.Entity.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YouTravel.DomainModels;

namespace Repositories.Configuration
{
    public class CollectInvoiceMap : EntityConfigurationBase<CollectInvoice>
    {
        public CollectInvoiceMap()
        {
            this.Property(p => p.Remark).HasMaxLength(200);

            this.HasRequired(p => p.Payment).WithMany().HasForeignKey(f => f.PaymentId);
            this.HasRequired(p => p.Creater).WithMany().HasForeignKey(f => f.CreaterId);
            this.HasOptional(p => p.Updater).WithMany().HasForeignKey(f => f.UpdaterId);
            this.HasMany(p => p.CollectInvoiceDetail).WithRequired(p => p.CollectInvoice).HasForeignKey(f => f.CollectInvoiceId);
            this.HasMany(p => p.CollectInvoiceGroup).WithRequired(p => p.CollectInvoice).HasForeignKey(f => f.CollectInvoiceId);

        }
    }
}
